package com.bdqn.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.bdqn.entity.Leave;
import com.bdqn.mapper.LeaveMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/sys/Leave")
public class LeaveController {
	@Autowired
	private LeaveMapper leaveMapper;
	
	@RequestMapping("/leavelist")
	public String getAllDepartment(HttpSession session,@RequestParam(value = "pageno", defaultValue = "1") int pageNo) {
		System.out.println("执行查询所有部门信息!!");
		PageHelper.startPage(pageNo, 5);
		List<Leave> listRole =leaveMapper.getAllLeave();
		PageInfo<Leave> pageInfo = new PageInfo<>(listRole);
		session.setAttribute("pageInfo", pageInfo);
		return "redirect:/jsp/sys/Leave/leavelist.jsp";

}
}